<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/inc/taglib.inc"%>
<%@ include file="/WEB-INF/inc/script.inc"%>
<!DOCTYPE html>
<html>

<head>

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<base href="${base}">
<title>中金通 | 广告列表</title>

<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="font-awesome/css/font-awesome.css" rel="stylesheet">

<link href="css/plugins/summernote/summernote.css" rel="stylesheet">
<link href="css/plugins/summernote/summernote-bs3.css" rel="stylesheet">
<!-- FooTable -->
<!--     <link href="css/plugins/footable/footable.core.css" rel="stylesheet"> -->

<!-- Data Tables -->
<link href="css/plugins/dataTables/dataTables.bootstrap.css"
	rel="stylesheet">
<link href="css/plugins/dataTables/dataTables.responsive.css"
	rel="stylesheet">
<link href="css/plugins/dataTables/dataTables.tableTools.min.css"
	rel="stylesheet">

<link href="css/animate.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">

<link href="css/plugins/datapicker/datepicker3.css" rel="stylesheet">

</head>

<body>

	<div id="wrapper">

		<!-- 左侧菜单 -->
		<jsp:include page="/WEB-INF/jsp/common/main-menu.jsp"></jsp:include>

		<div id="page-wrapper" class="gray-bg">
			<div class="row border-bottom">
				<!-- 头部工具栏区 -->
				<jsp:include page="/WEB-INF/jsp/common/main-header.jsp"></jsp:include>
			</div>
			<div class="row wrapper border-bottom white-bg page-heading">
				<div class="col-lg-10">
					<h2>广告管理</h2>
					<ol class="breadcrumb">
						<li><a href="common/platform">Home</a></li>
						<li><a href="noads/list">广告管理</a></li>
						<li><a href="noads/list">广告列表</a></li>
						<li class="active"><strong>修改广告</strong></li>
					</ol>
				</div>
				<div class="col-lg-2"></div>
			</div>

			<div class="row" style="margin-top: 10px;">
				<div class="col-md-12">
					<div class="tabs-container">
						<ul class="nav nav-tabs">
							<li><a href="noads/list"> 广告列表 </a></li>
							<li><a href="noads/add"> 新增广告 </a></li>
							<li class="active"><a href="noads/edit"> 修改广告 </a></li>
						</ul>
						<div class="tab-content">
							<div class="tab-pane active">
								<div class="panel-body">
								<form method="post" id="editForm">
										<div class="modal-body">
											<div class="row">
												<div class="col-md-6">
													<div class="row">
														<div class="col-sm-12">
															<div class="form-group">
																<label class="control-label" for="adsName"><font color="red">*&nbsp;&nbsp;</font>广告名称</label>
																<input type="text" id="adsName" name="adsName"
																	class="form-control" value="${model.adsName}" placeholder="广告名称">
																	<input type="hidden" id="id" name="id" class="form-control" value="${model.id}">
															</div>
														</div>
													</div>
													<div class="row">
														<div class="col-sm-6">
															<div class="form-group">
																<label class="control-label" for="state"><font color="red">*&nbsp;&nbsp;</font>状态</label> <select
																	class="form-control m-b" id="state" name="state">
																	<option value="0">未发布</option>
																	<option value="1">已发布</option>
																</select>
															</div>
														</div>
														<div class="col-sm-6">
															<div class="form-group">
																<label class="control-label" for="orders"><font color="red">*&nbsp;&nbsp;</font>排序值</label> <input
																	type="text" id="orders" name="orders" value="${model.orders}"
																	class="form-control">
															</div>
														</div>
													</div>
													<div class="row">
														<div class="col-sm-6">
															<div class="form-group">
																<label class="control-label" for="platform"><font
																	color="red">*&nbsp;&nbsp;</font>发布平台</label> <select
																	class="form-control m-b" id="platform" name="platform">
																	<option value="1" selected="selected">所有平台</option>
																	<option value="2">投后APP</option>
																	<option value="3">理财师pad</option>
																</select>
															</div>
														</div>
														<div class="col-sm-6">
															<div class="form-group">
																<label class="control-label" for="link"><font
																	color="red">*&nbsp;&nbsp;</font>跳转类型</label> <select
																	class="form-control m-b" id="link" name="link">
																	<option value="0">产品页面</option>
																	<option value="1">网页</option>
																</select>
															</div>
														</div>
													</div>
													<div class="row">
														<div class="col-sm-12">
															<div class="form-group" id="productDiv">
																<label class="control-label" for="productId">对应产品</label>
																<select class="form-control m-b" id="productId"
																	name="productId">
																	<option value="">无</option>
																	<c:forEach items="${productList}" var="list"
																		varStatus="status">
																		<option value="${list.id}">${list.productName}</option>
																	</c:forEach>
																</select>
															</div>
														</div>
													</div>
													<div class="row">
														<div class="col-sm-12" id="urlDiv" >
															<div class="form-group">
																<label class="control-label" for="url">跳转链接</label> <input
																	type="text" id="url" name="url" class="form-control"
																	value="${model.url}" placeholder="http://www.baidu.com">
															</div>
														</div>
													</div>
												</div>
												<div class="col-md-6">
													<div class="row">
														<div class="col-sm-6">
															<div class="form-group">
																<label class="control-label" for="file"><font color="red">*&nbsp;&nbsp;</font>广告图片</label> 
																<input type="file" id="file" name="file" accept="image/gif, image/jpeg"> 
																<input type="hidden" id="thumbnail" name="thumbnail" value="${model.thumbnail}">
															</div>
															<div id="adsImg"><img src="${imagePrefix}${model.thumbnail}" width="256"></div>
														</div>
													</div>
												</div>
											</div>
										</div>


										<div class="form-group">
			                                   <div class="col-sm-4 col-sm-offset-5">
			                                      <button type="button" class="btn btn-white" data-dismiss="modal">
												<a href="noads/list"> 取消</a>
											</button>
											<button type="submit" class="btn btn-primary" id="addModel">保存</button>
			                                   </div>
			                               </div>
                                
										
									</form>
								</div>
								
							</div>
						</div>

					</div>

				</div>
			</div>
			<!-- 底部版权 -->
		<jsp:include page="/WEB-INF/jsp/common/main-footer.jsp"></jsp:include>
		</div>
		
	</div>


	<!-- Mainly scripts -->
	<script src="js/jquery-2.1.1.js"></script>
	<script src="js/bootstrap.min.js"></script>
	<script src="js/plugins/metisMenu/jquery.metisMenu.js"></script>
	<script src="js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
	<script src="js/plugins/jeditable/jquery.jeditable.js"></script>
	<script src="js/jquery.serialize-object.min.js" type="text/javascript"></script>
	<!-- Custom and plugin javascript -->
	<script src="js/inspinia.js"></script>
	<script src="js/plugins/pace/pace.min.js"></script>
	<script src="js/plugins/bootbox/bootbox.min.js" type="text/javascript"></script>
	<!-- Data picker -->
	<script src="js/plugins/datapicker/bootstrap-datepicker.js"></script>

	<!-- Data Tables -->
	<script src="js/plugins/dataTables/jquery.dataTables.min.js"></script>
	<script src="js/plugins/dataTables/dataTables.bootstrap.js"></script>
	<script src="js/plugins/dataTables/dataTables.responsive.js"></script>
	<script src="js/plugins/dataTables/dataTables.tableTools.min.js"></script>

	<!-- 业务 -->
	<script src="js/ajaxfileupload.js"></script>
	<script src="js/noads/ads-edit.js"></script>
	<script src="js/plugins/validate/jquery.validate.min.js" type="text/javascript"></script>

	<!-- Page-Level Scripts -->
	<script>
		$(document).ready(function() {
			AdsEdit.init();
			var state = ${model.state};
			if (state == true) {
				$("#state").val("1");
			} else {
				$("#state").val("0");
			}
			$("#platform").val("${model.platform}");
			$("#productId").val("${model.productId}");
			var url = "${model.url}";
			var productId = "${model.productId}";
			if(url == ""){
				$("#link").val("0");
				$("#productDiv").show();
				$("#urlDiv").hide();
			}else{
				$("#link").val("1");
				$("#productDiv").hide();
				$("#urlDiv").show();
			}
		});
		$('#link').change(function() {
			if ($("#link").val() == "0") {
				$("#productDiv").show();
				$("#urlDiv").hide();
			} else if ($("#link").val() == "1") {
				$("#productDiv").hide();
				$("#urlDiv").show();
			}
		});
	</script>

</body>
